<?php
	echo $catName;
	// $to=isset($to)?$to:NB_ARTICLES_PER_PAGE;
	// for($i=$from;$i<$to-1;$i++)
	// {
	foreach($articlesList as $articles)
	{
		$author=User::read($articles->getIdPublisherArt())
		 ?>
		  <div class="bloc">
			<!-- IMAGE A MODIFIER EN FONCTION DE L'ARTICLE -->
			<div class="img" style="background:url(./admin/images/<?php echo $articles->getPathImageArt();?>) no-repeat;">
			  <!-- IMAGE DU CADRE DE L'IMAGE DE L'ARTICLE -->
			  <img src="./res/css/images/post/cadre.png" alt="image" title="image" style="margin-left: -3px; margin-top: -2px;" />
			</div>

			<div class="date">
			  <?php
			  list($annee, $mois, $jour) = explode('-', $articles->getDateArt());
			  $semaine = date("w", mktime(0, 0, 0, $mois, $jour, $annee));
			  echo date_fran($jour, $mois, $annee, $semaine);
			  ?>
			</div>
			
      <?php 
				if(strlen($articles->getTitleArt())>40)
				{
					if(strlen($articles->getTitleArt())<42)
						echo '<div style="font-size:22px;" title="'.$article->getTitleArt().'"><h2>';
					elseif(strlen($articles->getTitleArt())<45)
						echo '<div style="font-size:20px;" title="'.$articles->getTitleArt().'"><h2>';
					elseif(strlen($articles->getTitleArt())<50)
						echo '<div style="font-size:18px;" title="'.$articles->getTitleArt().'"><h2>';
					elseif(strlen($articles->getTitleArt())<55)
						echo '<div  style="font-size:17px;" title="'.$articles->getTitleArt().'"><h2>';
					else
						echo '<div style="font-size:16px;" title="'.$articles->getTitleArt().'"><h2>';
					echo $articles->getTitleArt();
				}
				else
				{
					echo '<div  title="'.$articles->getTitleArt().'"><h2>';
					echo $articles->getTitleArt();
				}
			?>
				</h2></div>
			
			<div class="article">
				<?php
					$arcticle = $articles->getSummaryArt();
					$arcticle = str_replace("<p class='article'>", "", $arcticle);
					$arcticle = str_replace("</p>", "", $arcticle);
          if(strlen($arcticle)>250)
            echo substr($arcticle, 0, 250).' ...';
					else
						echo $arcticle;
        ?>
			</div>
		
			<br/><div class="readmore">
			  <!-- REMPLACER LE href="" PAR LA PAGE DE L'ARTICLE -->
			  <a href="?page=article.php&idArt=<?php echo $articles->getIdArt();?>">Lire la suite</a>
			</div>
			<div class="post_bottom2">
			  <!-- REMPLACER LES ELEMENTS EN PHP -->
			  <div class="com">
				<?php
						$author = User::read($articles->getIdPublisherArt());
						echo "<img src='./res/css/images/auteur.png'/> Auteur : ".$author->getFirstNameUser();
						
						?>
			  </div>
			  <!--<div>&nbsp;&nbsp;</div>--><div class="com">
				<img src="./res/css/images/bulle.png"/><a href="?page=article.php&idArt=<?php echo $articles->getIdArt();?>&id=coms"> Commentaire(s)</a>
			  </div>
			  <div class="post_link">
			  </div>
			  <!--<div class="post_link">
				<a href=""><img src="./res/css/images/post/rss.png" border="0" alt="Rss" /></a>
				<a href="http://www.facebook.com/webartblog"><img src="./res/css/images/post/facebook.png" border="0" alt="Facebook" /></a>
				<a href=""><img src="./res/css/images/post/twitter.png" border="0" alt="Twitter" /></a>
			  </div>-->
			</div>

		  </div> <!-- fin du div post -->
	  <?php
			
	}
	 
	//Pagination
	if(isset($nbPages) && $pagination)
	{
		 for($i=1; $i<=$nbPages; $i++)
			 echo "<a href='index.php?page=list_articles.php&numPageArt=$i'>$i</a>";
	}
	else
		//echo "LOL";

 ?>

		